﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorkflowFramework
{
    public class FlowStepResult
    {
        public bool Result { get; set; }
        public string? Message { get; set; }
        public int ErrorCode { get; set; }

        public static FlowStepResult Success(string? message = null)
        {
            return new FlowStepResult { Result = true, Message = message };
        }
        public static FlowStepResult Failed(int errorCode, string? message = null)
        {
            return new FlowStepResult { Result = false, ErrorCode = errorCode, Message = message };
        }

    }
    public class FlowStepResult<T> : FlowStepResult where T : new()
    {
        public T? Data { get; set; }
        public static FlowStepResult<T> Success(T? data, string? message = null)
        {
            return new FlowStepResult<T> { Result = true, Data = data, Message = message };
        }
        public static FlowStepResult<T> Failed(int errorCode, T? data, string? message = null)
        {
            return new FlowStepResult<T> { Result = false, Data = data, ErrorCode = errorCode, Message = message };
        }
    }
}
